# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit git-2 eutils

DESCRIPTION="Ancilliary tools for the D programming language compiler."
# For now it' only rdmd

HOMEPAGE="http://www.digitalmars.com/d/"

LICENSE="DMD"
SLOT="2"
KEYWORDS="~x86 ~amd64"
IUSE=""
EAPI="3"

RESTRICT="mirror"

PDEPEND="dev-lang/dmd
	dev-libs/druntime
	dev-libs/phobos"

src_unpack() {

	# rdmd
	EGIT_SOURCEDIR="${WORKDIR}/${PN}"
	EGIT_REPO_URI="git://github.com/D-Programming-Language/tools.git"
	git-2_src_unpack

	# man page
	EGIT_SOURCEDIR="${WORKDIR}/dmd"
	EGIT_REPO_URI="git://github.com/D-Programming-Language/dmd.git"
	git-2_src_unpack

	S="${WORKDIR}"
}

src_compile() {
	cd "${S}/${PN}"
	dmd -d rdmd.d || die "build failed"
}

src_install() {
	doman "${S}/dmd/docs/man/man1/rdmd.1" || die "man install failed"
	dobin "${S}/${PN}/rdmd" || die "rdmd install failed"
}
